import React from "react";
// import ReactDOM from "react-dom/client";
import ReactDOM from "react-dom";
import { HashRouter as Router, Route, Switch } from "react-router-dom";

import reportWebVitals from "./reportWebVitals";
import routerList from "./utils/routeList";
import "./index.css";

// const root = ReactDOM.createRoot(document.getElementById("root"));

ReactDOM.render(
  <React.StrictMode>
    <Router>
      <Switch>
        {routerList.map((list, index) => {
          const { path, component } = list;
          return <Route path={`/${path}`} render={() => component} />;
        })}
      </Switch>
    </Router>
  </React.StrictMode>, document.getElementById("root")
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
